<template>
<h1>表单组件</h1>
  <hr>
  <el-form style="width: 500px; margin: 0 auto;" label-width="80px">
    <el-form-item label="用户名">
      <el-input v-model="user.name" placeholder="请输入用户名"></el-input>

    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="user.password" placeholder="请输入密码" show-password></el-input>

    </el-form-item>
    <el-form-item label="性别：">
      <el-radio-group v-model="user.gender">
        <el-radio-button value='1' label="男"></el-radio-button>
        <el-radio-button value='0' label="女"></el-radio-button>

      </el-radio-group>
    </el-form-item>

      <el-form-item label="所在地">
        <el-select v-model="user.city" placeholder="请选择城市">
          <el-option value="北京"   label="北京"></el-option>
          <el-option value='上海'   label="上海"></el-option>
          <el-option value="深圳"   label="深圳"></el-option>
        </el-select>

      </el-form-item>

    <el-form-item label="管理员">
      <el-switch v-model="user.admin">

      </el-switch>

    </el-form-item>
    <el-form-item>
      <el-button type="success"  @click="submit">提交</el-button>
    </el-form-item>

  </el-form>



</template>
<script setup>
import {ref} from "vue";

const user=ref({
  name:'',
  password:'',
  gender:'',
  city:'',
  admin:false,
});
const submit=()=>{
  console.log(user.value);
}

</script>


<style scoped>

</style>